package com.turing.post.salesmanage.util;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * @销售单销售员明细
 * @author zxl
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SALEORDERSALESDETAIL")
@IdClass(SaleOrderSalesDetail.class)
public class SaleOrderSalesDetail implements Serializable {
    /**
     * 销售单ID
     */
	private BigInteger saleOrderId; 
	/**
	 * 销售员ID
	 */
	private BigInteger salesId; 
	/**
	 * 本单贡献度
	 */
//	private Integer degreeOfcontribution;  
	/**
	 * 实际销售金额
	 */
	private BigInteger salesAmount;

	public SaleOrderSalesDetail() {
		super();
	}

	@Id
	@Column(name = "SALEORDERID", nullable = false)
	public BigInteger getSaleOrderId() {
		return saleOrderId;
	}

	public void setSaleOrderId(BigInteger saleOrderId) {
		this.saleOrderId = saleOrderId;
	}

	@Id
	@Column(name = "SALESID", nullable = false)
	public BigInteger getSalesId() {
		return salesId;
	}

	public void setSalesId(BigInteger salesId) {
		this.salesId = salesId;
	}

//	@Column(name = "DEGREEOFCONTRIBUTION", nullable = false)
//	public Integer getDegreeOfcontribution() {
//		return degreeOfcontribution;
//	}
//
//	public void setDegreeOfcontribution(Integer degreeOfcontribution) {
//		this.degreeOfcontribution = degreeOfcontribution;
//	}
	
	@Column(name = "salesAmount")
	public BigInteger getSalesAmount() {
		return salesAmount;
	}

	public void setSalesAmount(BigInteger salesAmount) {
		this.salesAmount = salesAmount;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((this.getSaleOrderId() == null) ? 0 : this.getSaleOrderId().hashCode());
		result = prime * result + ((this.getSalesId() == null) ? 0 : this.getSalesId().hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SaleOrderSalesDetail other = (SaleOrderSalesDetail) obj;
		if (this.getSaleOrderId() == null) {
			if (other.getSaleOrderId() != null)
				return false;
		} else if (!this.getSaleOrderId().equals(other.getSaleOrderId()))
			return false;
		if (this.getSalesId() == null) {
			if (other.getSalesId() != null)
				return false;
		} else if (!this.getSalesId().equals(other.getSalesId()))
			return false;
		return true;
	}
}
